﻿@{
    ViewBag.Title = "添加通知";
}
@section scripts
{
    <script src="~/kindeditor/kindeditor-all-min.js"></script>
    <script src="~/kindeditor/lang/zh-CN.js"></script>
    <script>
        function doBegin() {
           window.top.$.msgBoxObj.showMsgInfo('正在提交数据....');
        }

        function doFail() {
            window.top.$.msgBoxObj.showMsgErr('网络异常!');
        }

        function doComplete(xhrObj) {
            $.processJsonMsg(xhrObj.responseText, function(response) {
                if (response.Statu === 1) {
                    window.top.topHelper.closeComWindow();
                    window.top.topHelper.updateDataGrid();
                }
            });
        }
        //初始化编辑器
        KindEditor.ready(function(K) {
            var options = {
                cssPath: '@Url.Content("~/kindeditor/themes/qq/qq.css")',
                uploadJson: '@Url.Action("UploadFile", "File", new {area = "Media"})',
                fileManagerJson: '@Url.Action("FileManager", "File", new {area = "Media"})',
                resizeType: 1, // 只能改变高度
                allowFileManager: true,
                filterMode: true,
                afterBlur: function() { editor.sync(); },
                afterUpload: function(url, data, name) {
                    console.log(url);
                    console.log(data);
                    console.log(name);
                }
            };
            window.editor = K.create('#Content', options);
        });
    </script>
}
@section headSection
{
    <style>
        #news-form {
            margin-top: 20px;
        }
        #news-form .input-div {
            margin: 30px;
            display: block;
        }
    </style>
}
<div>
    @using (Ajax.BeginForm("PostNotice", new { area = "Admin", controller = "Notice" }, new AjaxOptions()
    {
        HttpMethod = "post",
        OnBegin = "doBegin",
        OnFailure = "doFail",
        OnComplete = "doComplete"
    }, new { id = "news-form", name = "news-form" }))
    {
        <div class="input-div"><input id="Title" name="Title" class="easyui-textbox" data-options="label:'标题：',labelPosition:'left',labelWidth:100," style="width: 100%; height: 30px;"></div>
        <div class="input-div"><input id="Content" data-options="multiline:true" name="Content" style="width: 100%; height: 300px"></div>
        <div style="display: block;margin-left: 30px">
            <input type="submit" class="easyui-linkbutton button-blue l-btn l-btn-small" name="submit" style="width: 46px; height: 30px; margin: 10px" value="提交" />
            <input type="reset" class="easyui-linkbutton button-red l-btn l-btn-small" style="width: 46px; height: 30px; margin: 10px" name="reset" value="重置" />
        </div>
    }
</div>


